<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="../vue.js"></script>
    <style>
      .login {
        background-color: yellowgreen;
      }
      .register {
        background-color: pink;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <button @click="isLogin=true">登录</button>
      <button @click="isLogin=false">注册</button>

      <div class="login" v-if="isLogin">
        用户名：<input type="text" key="login" />
        <br />
        密码：<input type="password" key="login1" />
      </div>

      <div class="register" v-if="!isLogin">
        用户名：<input type="text" />
        <br />
        邮箱：<input type="text" />
        <br />
        验证码：<input type="text" />
      </div>
    </div>
    <script>
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            isLogin: true,
          };
        },
      });
    </script>
  </body>
</html>
